/*
 * @Descripttion:
 * @version:
 * @Author: anan
 * @Date: 2020-10-02 10:31:08
 * @LastEditors: anan
 * @LastEditTime: 2020-10-04 09:14:50
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    title: '主页',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: 'index',
        name: 'index',
        title: '主页',
        component: () => import('@/views/index.vue')
      }
    ]
  },
  {
    path: '/retail',
    name: 'retail',
    title: '江西业绩分析',
    component: Layout,
    redirect: '/retail/index',
    children: [
      {
        path: 'index',
        name: 'retailAnalysis',
        title: '江西业绩分析',
        component: () => import('@/views/retail/index.vue')
      }
    ]
  },
  {
    path: '/lay',
    name: 'lay',
    title: 'lay',
    component: () => import('@/layout/index.vue')
  }
  // ,
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

// hash   history
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
